package observer;

import java.util.ArrayList;
import java.util.List;

public class NewsSubject implements Subject{
    List<Observer> observerList = new ArrayList<Observer>();

    @Override
    public void add(Observer observer) {
        observerList.add(observer);
    }

    @Override
    public void notify(String message) {
        observerList.stream().forEach(observer -> {
            observer.printMsg(message);
        });
    }
}
